class Solution:
    def integerBreak(self, n: int) -> int:
        dp = {0: 0, 1: 0, 2: 1, 3: 2}
        for x in range(4, n + 1):
            for cut in (2, 3):
                dp[x] = max(dp.get(x, 0), cut * (x - cut), cut * dp[x - cut])
        return dp[n]
